/*
 * FileTransferTcpClientSession.h
 *
 *  Created on: Sep 13, 2012
 *      Author: shawnmao
 */

#ifndef FILETRANSFERTCPCLIENTSESSION_H_
#define FILETRANSFERTCPCLIENTSESSION_H_

#include "TcpClientSession.h"
#include "Common.h"
#include "type.h"

class FileTransferTcpClientSession : public TcpClientSession
{
public:
	FileTransferTcpClientSession(string local_addr,
								 uint16_t local_port,
								 string remote_addr,
								 uint16_t remote_port,
								 string file_path,
								 string file_name);
	virtual void execute_cli_protocol();

private:
	int send_ctrl_msg(string send_msg);
	int send_file();

	int recv_msg_type();
	int recv_msg_len();
	int recv_ctrl_msg(string* recv_msg, ssize_t msg_len);

private:
	TcpFileTransferState m_transfer_state;
	string m_file_path;
	string m_file_name;
};


#endif /* FILETRANSFERTCPCLIENTSESSION_H_ */
